package cn.myschool.java79.test2;

import cn.myschool.java79.dao.StudentMapper;
import cn.myschool.java79.entity.Student;
import cn.myschool.java79.util.MybatisUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class TestGetStu18 {
    public static void main(String[] args) {
        SqlSession s= MybatisUtil.get();
        Page<Student> objects = PageHelper.startPage(2, 5);
        try {

            StudentMapper mapper = s.getMapper(StudentMapper.class);
            List<Student> list = mapper.search18("李","1",null);

            //list.forEach(System.out::println);
            System.out.println();
            objects.getResult().forEach(System.out::println);
            System.out.println(objects.getPages()+"总页数");
            System.out.println(objects.getTotal()+"总条数：");
        }finally {
            MybatisUtil.close(s);
        }
    }
}
